@import '../../../variables';
@import '../tasks/task/task.component.mixins';

:host {
  overflow: hidden !important;
}

:host ::ng-deep task {
  .drag-handle {
    pointer-events: none;

    .drag-handle-ico {
      visibility: hidden !important;
    }
  }
}

.wrapper {
  padding-top: $s * 2;
  padding-bottom: $s * 2;
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow-x: hidden;
  @include scrollYImportant();
}

.inner-wrapper {
  max-width: $component-max-width;
  margin: auto;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  padding-bottom: $s;
  flex-direction: column;
  @include mq(xxs) {
    flex-direction: row;
  }
  // TODO check if we might want this
  //&:first-child {
  //  top: 0;
  //  position: sticky;
  //  z-index: 44;
  //}
}

.row,
.col {
  //border: 1px dashed rgba(0, 0, 0, .5)
}

.col {
  &.time {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-width: 80px;
    text-align: center;

    &.hasTime {
      padding: $s * 2 0 $s;
      font-weight: bold;
      @include mq(xxs) {
        padding: 0;
        font-weight: normal;
      }
    }

    @include mq(xxs) {
      margin-top: -$s * 0.5;
      margin-bottom: -$s * 0.5;
      border-right: 2px solid;

      @include lightTheme() {
        border-color: $light-theme-separator-color;
      }
      @include darkTheme() {
        border-color: $dark-theme-separator-color;
      }

      &.hasTime:after {
        display: block;
        content: '';
        width: 8px;
        height: 2px;
        right: -5px;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);

        @include lightTheme() {
          background: $light-theme-separator-color;
        }
        @include darkTheme() {
          background: $dark-theme-text-color;
        }
      }
    }

    .row:first-child & {
      &:before {
        content: '';
        position: absolute;
        top: 0;
        transform: none;
        width: 16px;
        height: 2px;
        right: -9px;

        @include lightTheme() {
          background: $light-theme-separator-color;
        }
        @include darkTheme() {
          background: $dark-theme-separator-color;
        }
      }
    }

    .row:last-child & {
      &:before {
        color: $dark-theme-separator-color;
        content: 'ᐯ';
        position: absolute;
        top: 100%;
        margin-top: -10px;
        transform: none;
        width: 21px;
        font-size: 13px;
        text-align: center;
        right: -12px;
        @include lightTheme() {
          color: $light-theme-separator-color;
        }
        @include darkTheme() {
          color: $dark-theme-separator-color;
        }
      }
    }
  }

  &.right {
    padding-left: $s * 2;
    padding-right: $s;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: stretch;

    > * {
      flex: 1;
    }
  }
}

.time .date {
  font-size: 13px;
}

$sb-radius: 28px;
$sb-radius-continued: 56px;
$sb-radius-small: 4px;

task.split-task::ng-deep .box {
  border-top-left-radius: $sb-radius !important;
  border-top-right-radius: $sb-radius !important;
  border-bottom-left-radius: $sb-radius-small;
  border-bottom-right-radius: $sb-radius-small;
}

.task-continued {
  align-self: flex-start;
  padding-left: 56px;
  padding-top: $s;
  padding-bottom: $s;
  border-radius: $sb-radius-small $sb-radius-continued $sb-radius-small
    $sb-radius-continued;

  display: flex;
  position: relative;

  &.last {
    border-radius: $sb-radius-small $sb-radius-small $sb-radius-continued
      $sb-radius-continued;
  }

  @include lightTheme {
    background: $task-c-bg-light;
  }

  @include darkTheme {
    background: $task-c-bg-dark;
  }

  &:after {
    content: '...';
    position: absolute;
    top: 50%;
    left: 0;
    margin-top: -0.5 * $s;
    transform: translateY(-50%);
    text-align: center;
    width: 56px;
    font-size: 20px;
  }

  .title {
    flex: 1;
  }

  .time-to-go {
    margin-left: auto;
    padding-left: $s;
    padding-right: $s * 2;
    font-style: italic;
    opacity: 0.5;
    font-size: 14px;
    font-weight: 300;
  }
}

.work-start,
.work-end {
  text-align: center;
  //border-bottom: 1px dashed;
  padding-top: $s;
  padding-bottom: $s;
  //font-weight: bold;
}

.day-crossing {
  text-align: center;
  padding-top: $s;
  padding-bottom: $s;
  font-weight: bold;
  border-bottom: 0;
  position: relative;
  font-size: 17px;
  display: flex;
  align-items: center;

  &::before,
  &::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #000;
    border-bottom: 1px dashed;

    @include lightTheme() {
      border-color: $light-theme-separator-color;
    }
    @include darkTheme() {
      border-color: $dark-theme-separator-color;
    }
  }

  &::before {
    margin-left: -88px;
    padding-left: 88px;
  }

  &:not(:empty)::before {
    margin-right: 0.25em;
  }

  &:not(:empty)::after {
    margin-left: 0.25em;
  }

  .day {
    font-weight: normal;
  }
}

.no-tasks-msg {
  margin-top: $s * 3;
  text-align: center;
}

.up-down {
  position: absolute;
  flex-direction: column;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;

  .row:hover & {
    animation: fadeIn $transition-duration--enter $ani-enter-timing;
    display: flex;
  }
}

.scheduled-extra-btn {
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  .row:hover & {
    animation: fadeIn $transition-duration--enter $ani-enter-timing;
    display: block;
    //transform: translate(-50%, -50%) scale(1.5);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
